﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>General Report Manager</title>
    <link href="../css/manual.css" rel="stylesheet" type="text/css">
    <script src="../js/toc.js"></script>
    <script src='../js/jquery.min.js'></script>
    <script src="../js/back_to_top.js"></script>
</head>
<body onload="generateTOC(document.getElementById('toc'));">
    <header>
        <nav><small><a id="go_home" href="../index.html?lang=en_US">Go to main help page</a></small></nav>

        <a href="#" id="back-to-top"><img src="../img/backtotop.png" alt="Back to Top" /></a>
        <!--Smooth Back to Top Button End-->

        <h1>General Report Manager</h1>
    </header>

    <!-- ToC generated by Javascript -->
    <nav id="toc"></nav>

    <h2>Opening General Report Manager</h2>
    <p>
        Call General Report Manager (<abbr>GRM</abbr>) tool or use main menu
        <kbd><samp>Tools</samp> &rarr; <samp>General Report Manager&hellip;</samp>
        </kbd>.
    </p>
    <img class="shadow" alt="GRM Toolbar" src="../en_US/grm_toolbar.png">

    <h2>Adding a new report</h2>
    <p>There are 2 options available.</p>

    <h3>Creating the report from scratch</h3>
    <ol>
        <li>Using the Navigator, mouse right-click on the
            <kbd><samp>Reports</samp></kbd> label.</li>
        <li>Choose the menu item: <kbd><samp>New Empty Report</samp></kbd>.</li>
        <li>Enter the name for the new report group and the new name.</li>
        <li>Rename reports, if required, by right-clicking on the menu item:
            <kbd><samp>Rename Report</samp></kbd>.</li>
        <li>Five tabs will be displayed: Output, SQL, Lua, Template and
            Description.</li>
        <li>
            Choose the tab: SQL, insert the SQL script into the editor window,
            check that the SQL script finishes with a semicolon, then press
            the <kbd><samp>Save</samp></kbd> button.
        </li>
        <li>Press the <kbd><samp>Test</samp></kbd> button to execute the SQL
            script.</li>
        <li>If the test is passed the <kbd><samp>Create Template</samp></kbd>
            button will become available. Press it to generate an HTML
            template for the report.</li>
        <li>Press the <kbd><samp>Run</samp></kbd> button to get the HTML
            report in the Output window.</li>
    </ol>
    <img class="shadow" alt="Creation of a new report from scratch animation"
    src="../en_US/grm.gif">

    <h4>Report Parameters</h4>
    <p>
        For MMEX version 1.3.4 there is a possibility to transfer dates into a
        report’s SQL script.
        There are three options available: <var>&single_date</var>,
        <var>&begin_date</var>, <var>&end_date</var>.
        In case if a SQL contains one of the parameter above it will be
        replaced with a date from a calendar widget.
        For example, this SQL script returns all accounts balances for the
        specified date:
    </p>
<pre><code class="language-sql">with b as  (
    select ACCOUNTID, STATUS
        , (case when TRANSCODE = 'Deposit' then TRANSAMOUNT else -TRANSAMOUNT end) as TRANSAMOUNT
        , TRANSDATE
    from CHECKINGACCOUNT_V1    
    where STATUS <> 'V'
        and TRANSDATE <= '&single_date'
    union all
    select TOACCOUNTID, STATUS
        , TOTRANSAMOUNT ,TRANSDATE
    from CHECKINGACCOUNT_V1
    where TRANSCODE = 'Transfer'
        and STATUS <> 'V'
        and TRANSDATE <= '&single_date'
    )
select a.ACCOUNTNAME, a.ACCOUNTTYPE,
total(TRANSAMOUNT) + a.INITIALBAL as Balance
from ACCOUNTLIST_V1 as a
left join b on a.ACCOUNTID=b.ACCOUNTID
where a.STATUS = 'Open'  and a.ACCOUNTTYPE !='Investment'
group by a.ACCOUNTNAME order by a.ACCOUNTNAME asc;
</code></pre>
    <img class="shadow" alt="GRM report output using single date parameter
    example" src="../en_US/grm_custom_date.png">

    <h3>Importing report</h3>
    <p>
        There are a lot of reports provided by users or developers on
        <a href="https://github.com/moneymanagerex/general-reports/releases" target="_blank">GitHub</a>.
    </p>

    <h2>Exporting report definition</h2>
    <p>
        If you have created any helpful report it may be exported into ZIP
        file.
    </p>

    <footer><p><small>
        Copyright &copy; 2005-2009 Madhan Kanagavel<br>
        Copyright &copy; 2013-2020 MMEX contributors<br>
        <span id="translator">Translators: MMEX contributors</span>
    </small></p></footer>
    <script>
        var LANG = document.getElementsByTagName('html')[0].getAttribute('lang');
        var tr = document.getElementById("translator");
        if (LANG == 'en')
            tr.parentNode.removeChild(tr);
    </script>

</body>
</html>
